<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/vue.js"></script>
    <!-- <link rel="stylesheet" href="./lib/bootstrap-3.4.1-dist/css/bootstrap.min.css"> -->
    <style>
        .box {
            height: 100px;
            width: 100px;
        }
    </style>
</head>

<body>
    <div id="app">
        <div>
            r:<input type="text" v-model.number="r"> g:
            <input type="text" v-model.number="g"> b:
            <input type="text" v-model.number="b">
        </div>
        <div class="box" :style="{backgroundColor:rgb}">
            {{rgb}}
        </div>
        <button @click="show">按钮</button>
    </div>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                r: 0,
                g: 0,
                b: 0
            },
            methods: {
                show() {
                    console.log(this.rgb);
                    console.log('show方法');
                }
            },
            filters: {},
            watch: {},
            computed: {
                // 计算属性
                rgb() {
                    return `rgb(${this.r},${this.g},${this.b})`
                }
            }
        })
    </script>
</body>

</html>